#ifndef QHTTPTEST_H
#define QHTTPTEST_H

#include <QMainWindow>
#include<QNetworkAccessManager>
#include<QNetworkAddressEntry>
#include<QNetworkReply>
#include<QDesktopServices>

#include<QFile>
#include<QFileInfo>
#include<QFileDialog>
#include<QMessageBox>
#include<QUrl>
#include<QDir>
#include<QEventLoop>

namespace Ui {
class QHttpTest;
}

class QHttpTest : public QMainWindow
{
    Q_OBJECT

public:
    explicit QHttpTest(QWidget *parent = nullptr);
    ~QHttpTest();

private slots:
    void on_btnDownload_clicked();
    void on_btnSave_clicked();
    void on_btnClose_clicked();
    void on_downloadProgress(qint64 byteReceive,qint64 byteTotal);
    void on_finished();
    void on_readyRead();

private:
    QNetworkAccessManager m_mgr;

    QNetworkReply* m_pReply;

    QString m_filePath;

    QFile m_file;

    QEventLoop m_eventLoop;

private:
    Ui::QHttpTest *ui;
};

#endif // QHTTPTEST_H
